package com.lu.练习2_动态数组;

import jdk.nashorn.internal.ir.CallNode;

/**
 * @author xiaolu
 * @version 1.0
 * @date 2020/10/27 9:27
 */
public class Main {
    public static void main(String[] args) {
        // int -> Integer
        // 所有的类，最终都继承java.lang.Object
        // new是向堆空间申请内存
        ArrayList<Person> persons  = new ArrayList<>();
        persons.add(new Person(10, "Jack"));
        persons.add(new Person(12, "James"));
        persons.add(new Person(15, "Rose"));
        persons.clear();
        persons.add(new Person(22, "abc"));

        System.out.println(persons);
        ArrayList<Integer> ints  = new ArrayList<>();
        ints.add(10);
        ints.add(10);
        ints.add(22);
        ints.add(33);
        System.out.println(ints);

//        ArrayList<Person> persons = new ArrayList<>();
//
//        persons.add(new Person(10, "xiaolu"));
//        persons.add(new Person(12, "xiaohe"));
//        persons.add(new Person(15, "xiaoli"));
//
//        System.out.println(persons);
    }
}
